/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package cn.ac.iie.di.tools;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

/**
 *
 * @author G
 */
public class FileTools {
    //读取文件内容

    public static synchronized String readFile(String filename) {
        StringBuffer sb = new StringBuffer();
        try {
            FileReader read = new FileReader(filename);
            BufferedReader br = new BufferedReader(read);
            String row = "";
            while ((row = br.readLine()) != null) {
                sb.append(row);
            }
        } catch (FileNotFoundException e) {

        } catch (IOException e) {

        }
        return sb.toString();
    }
}
